namespace Probel.Client.Commands
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    using Probel.Client.StatLoggerReference;
    using Probel.Statistics.Helpers;

    [Command("register", "reg", "Register a dummy istance into the database")]
    public class RegisterCommand : ICommand
    {
        #region Fields

        private readonly string[] Response = new string[] { "y", "yes" };

        #endregion Fields

        #region Methods

        public void Execute(dynamic context)
        {
            var os = SystemInfo.Load();
            var proxy = context.ProxyLogger as IStatLogger;
            var input = context.Input as Input;

            var result = input.Read("Do you want to add dummy registration? (Y(es)/N(o)): ");
            if (Response.Contains(result.ToLower()))
            {
                proxy.Register(os.Serial, os.Version, "TestClient");
            }
            else { Console.WriteLine("Cancelled"); }
        }

        #endregion Methods
    }
}